clearvars -except Globaloption option

if exist('Globaloption', 'var') == 0
    Globaloption.savefig = 1;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This code reads in the VAR dynamics and produce the Campbell-Shiller decomposition in the paper
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Load data
breakpoint = 0;
n_coint_var = 3;

startdatenum = 1601;
enddatenum = 1794;

loaddata;
ttime = [startdate:enddate];

output_rp = 0.03;

filename = ['MAT/Netherland_fullsample_', num2str(round(output_rp * 10000))];

%% Estimation
run cs_estimation.m

%% steady-state upper bound calculation
upper = exp(pxbar) * (mean(tau - g));

gdpreturn = output_rp + y0nom_10 - pi0;

save MAT/Netherland_para_30_fullsample.mat k0x k1x s upper pdX pxbar gdpreturn debt

